<template>
    <div id="OrdersTitle">
        <v-details :inputConfig="inputConfig" :detailData="inputData" :rules="rules" @pop="setdata"></v-details>
    </div>
</template>

<script>
    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        props: {
            inputData: {
                type: Object,
            }
        },
        mixins: [baseMixin],
        name: "OrdersTitle",
        data() {
            return {
                inputConfig: [
                    [
                        {
                            type: "input",
                            label: this.$t('out.orderkey'),
                            disabled: true,
                            props: "orderkey",
                        },
                        {
                            type: "select",
                            label: this.$t('common.status'),
                            disabled: true,
                            props: "status",
                            options: this.getOptions("queryOrderStatusDropDown")
                        },
                        {
                            type: "table",
                            label: this.$t('config.shipper'),
                            disabled: !this.$store.state.newFlag,
                            props: "storerkey",
                            tableConfig: [
                                {
                                    label: this.$t('config.shipper'),
                                    prop: "storerkey",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.company'),
                                    prop: "company",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.city'),
                                    prop: "city",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.provice'),
                                    prop: "state",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.postcode'),
                                    prop: "zip",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.contact'),
                                    prop: "contact",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.phone'),
                                    prop: "phone",
                                    input: "input",
                                },
                            ],
                            url: `queryStorer/1/?/${this.$store.state.wms}`
                        },
                        {
                            type: "table",
                            label: this.$t('bill.carrierCode'),
                            props: "carriercode",
                            tableConfig: [
                                {
                                    label: this.$t('config.shipper'),
                                    prop: "storerkey",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.company'),
                                    prop: "company",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.city'),
                                    prop: "city",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.provice'),
                                    prop: "state",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.postcode'),
                                    prop: "zip",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.contact'),
                                    prop: "contact",
                                    input: "input",
                                },
                                {
                                    label: this.$t('config.phone'),
                                    prop: "phone",
                                    input: "input",
                                },
                            ],
                            url: `queryStorer/3/?/${this.$store.state.wms}`
                        },
                        {
                            type: "select",
                            label: this.$t('in.priority'),
                            disabled: false,
                            props: "priority",
                            options: this.getOptions("querycodeLkup/ORDRPRIOR")
                        },
                        {
                            type: "input",
                            label: this.$t('out.totalordered'),
                            disabled: !this.$store.state.newFlag,
                            props: "totalordered",
                        },
                        {
                            type: "checkbox",
                            label: this.$t('out.suspendedindicator'),
                            props: "suspendedindicator",
                            disabled: !this.$store.state.newFlag,
                        },
                        {
                            type: "checkbox",
                            label: this.$t('out.allocation'),
                            props: "apportion",
                            disabled: !this.$store.state.newFlag,
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: this.$t('bill.orderType'),
                            disabled: false,
                            props: "type",
                            options: this.getOptions("querycodeLkup/ORDERTYPE")
                        },
                        {
                            type: "input",
                            label: this.$t('out.pokey'),
                            disabled: !this.$store.state.newFlag,
                            props: "pokey",
                        },
                        {
                            type: "input",
                            label: this.$t('config.deliveryAddress'),
                            disabled: !this.$store.state.newFlag,
                            props: "consigneekey"
                        },
                        {
                            type: "input",
                            label: this.$t('out.ordergroup'),
                            disabled: false,
                            props: "ordergroup"
                        },
                        {
                            type: "date",
                            label: this.$t('in.podate1'),
                            disabled: !this.$store.state.newFlag,
                            props: "orderdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.plannedshipdate'),
                            disabled: !this.$store.state.newFlag,
                            props: "plannedshipdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.deliverydate2'),
                            disabled: !this.$store.state.newFlag,
                            props: "deliverydate2"
                        },
                    ],
                    [
                        {
                            type: "date",
                            label: this.$t('out.requestedshipdate'),
                            disabled: !this.$store.state.newFlag,
                            props: "requestedshipdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.scheduledshipdate'),
                            disabled: !this.$store.state.newFlag,
                            props: "scheduledshipdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.promisedshipdate'),
                            disabled: !this.$store.state.newFlag,
                            props: "promisedshipdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.actualshipdate'),
                            disabled: !this.$store.state.newFlag,
                            props: "actualshipdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.deliverydate'),
                            disabled: !this.$store.state.newFlag,
                            props: "deliverydate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.promiseddelvdate'),
                            disabled: !this.$store.state.newFlag,
                            props: "promiseddelvdate"
                        },
                        {
                            type: "date",
                            label: this.$t('out.effectivedate'),
                            disabled: !this.$store.state.newFlag,
                            props: "effectivedate"
                        },
                    ],
                    [
                        {
                            type: "input",
                            label: this.$t('in.pokey1'),
                            disabled: !this.$store.state.newFlag,
                            props: "referencenum"
                        },
                        {
                            type: "input",
                            label: this.$t('out.externorderkey',{no:1}),
                            disabled: true,
                            props: "externorderkey"
                        },
                        {
                            type: "input",
                            label: this.$t('out.externorderkey',{no:2}),
                            disabled: !this.$store.state.newFlag,
                            props: "externalorderkey2"
                        },
                        {
                            type: "input",
                            label: this.$t('out.tradingpartner'),
                            disabled: !this.$store.state.newFlag,
                            props: "tradingpartner"
                        },
                        {
                            type: "input",
                            label: this.$t('out.rtxexternaltype1'),
                            disabled: !this.$store.state.newFlag,
                            props: "rtxexternaltype"
                        },
                    ],
                    [
                        {
                            type: "input",
                            label: this.$t('out.loadid'),
                            disabled: false,
                            props: "loadid"
                        },
                        {
                            type: "input",
                            label: this.$t('in.door'),
                            disabled: false,
                            props: "door"
                        },
                        {
                            type: "input",
                            label: this.$t('out.route'),
                            disabled: false,
                            props: "route"
                        },
                        {
                            type: "input",
                            label: this.$t('in.trailernumber'),
                            disabled: false,
                            props: "trailernumber"
                        },
                        {
                            type: "input",
                            label: this.$t('out.stop'),
                            disabled: false,
                            props: "stop"
                        },
                        {
                            type: "select",
                            label: this.$t('in.receiptfinishflag'),
                            disabled: false,
                            props: "orderfinishflag",
                            options: [
                                {code: 'P', description: 'P'},
                                {code: 'PS', description: 'PS'},
                                {code: 'PF', description: 'PF'},
                                {code: 'S', description: 'S'}
                            ]
                        },
                        {
                            type: "select",
                            label: this.$t('config.allocaStrategy'),
                            disabled: false,
                            props: "allocatestrategykey",
                            options: this.getOptions("queryAllocatestrategyDropDown")
                        },
                    ]
                ],
                rules: {
                    orderkey: [
                        {required: true, trigger: 'blur'},
                    ],
                    storerkey: [
                        {required: true, trigger: 'blur'},
                    ],
                    priority: [
                        {required: true, trigger: 'blur'},
                    ],
                    type: [
                        {required: true, trigger: 'blur'},
                    ]
                },
                detailData: {}
                // inputData: {
                //     orderkey: "",
                //     status: "",
                //     storerkey: "",
                //     carriercode: "",
                //     priority: "",
                //     totalordered: "",
                //     suspendedindicator: 0,
                //     apportion: 0
                // }
            }
        },
        computed: {},
        methods: {
            setdata(data, id, close, listId) {
                if (id == "2") {
                    this.inputData.storerkey = data.storerkey;
                }
                if (id == "3") {
                    this.inputData.carriercode = data.storerkey;
                }
                close(false);
            }
        },
        mounted() {
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
